package cfdt.ldl.file.controller;

import cfdt.common.vo.ObjectBaseResponse;
import cfdt.ldl.file.api.request.DownloadFileRequest;
import cfdt.ldl.file.api.request.UploadFileRequest;
import cfdt.ldl.file.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文件中心-Controller
 *
 * <pre>
 * Modify Information:
 * Author       Date          Description
 * ============ ============= ============================
 * wangxiao      2021年8月11日上午11:43:39      创建Controller
 *
 * </pre>
 */
@RestController
@RequestMapping("/risk")
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 根据ID获取文件
     *
     * @param request
     * @return
     */
    @SuppressWarnings("rawtypes")
    @GetMapping("/downloadFile")
    public ObjectBaseResponse downloadFile(@RequestBody DownloadFileRequest request) {
        return fileService.downloadFile(request);
    }

    /**
     * 根据ID获取文件
     *
     * @param request
     * @return
     */
    @SuppressWarnings("rawtypes")
    @GetMapping("/uploadFile")
    public ObjectBaseResponse uploadFile(@RequestBody UploadFileRequest request) {
        return fileService.uploadFile(request);
    }

}
